package com.logos.cartoon;

import com.logos.cartoon.ui.HomeFrame;
import com.logos.cartoon.ui.LoginFrame;
import com.logos.cartoon.ui.MainFrame;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import javax.swing.*;

/**
 * @author logos
 * @date 2025/05/23
 */
@SpringBootApplication
@MapperScan("com.logos.cartoon.mapper")
public class CartoonSwingApplication {

    public static void main(String[] args) {
        // 启动Spring上下文
        ConfigurableApplicationContext ctx = SpringApplication.run(CartoonSwingApplication.class, args);

        // 在EDT线程中启动Swing界面
        SwingUtilities.invokeLater(() -> {
            HomeFrame homeFrame = ctx.getBean(HomeFrame.class);
            homeFrame.setVisible(true);
//            LoginFrame loginFrame = ctx.getBean(LoginFrame.class);
//            loginFrame.setVisible(true);
        });
    }

}
